<?php

declare (strict_types=1);

namespace app\common\model;

class ContractBonusLevel extends Base
{
    protected $name = 'contract_bonus_level';

    public static function getCapping($my_dedicate)
    {
        $level = self::order('capping', 'desc')->field('capping,dedicate')->select();
        $capping = 0;
        foreach ($level as $key => $val){
            if($my_dedicate < $val['dedicate']){
                continue;
            }else{
                $capping = $val['capping'];
                break;
            }
        }

        return $capping;
    }
}